/*
 * @Author: Miao 747296174@qq.com
 * @Date: 2023-07-23 23:13:46
 * @LastEditors: Miao 747296174@qq.com
 * @LastEditTime: 2023-07-23 23:17:08
 * @FilePath: /ipc/test/testshm.cpp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include<iostream>
#include<unistd.h> 
#include<sys/ipc.h>
#include<sys/shm.h>
#include<cerrno>
#include<cstring>

using namespace std;
int main()
{
  key_t key = ftok("/home/lxm/code",0x16);
  int shmid = shmget(key,4096,IPC_CREAT | IPC_EXCL|0666);
  if (shmid < 0)
  {
      cout<< "shmget: " << strerror(errno) << "\n";
      return 2;
  }


  return 0;
}
